import React,{useState} from 'react'
import Taro from '@tarojs/taro'
import { View, Text, Image} from '@tarojs/components'

function MenuBar (){
  const [navList, useNavList] = useState(
    [
      {url:require('../static/images/moguj.png'), text:'水果'},
      {url: require('../static/images/moguj.png'), text:'蔬菜'},
      {url: require('../static/images/moguj.png'), text:'肉禽蛋品'},
      {url: require('../static/images/moguj.png'), text:'海鲜水产'},
      {url: require('../static/images/change.png'), text:'全部分类'},
    ]
  )
  function goToIfcationDetails(item,index){
    if(index == 4){
      Taro.switchTab({
        url: '/pages/ification/index'
      })
      return  false
    }
    Taro.navigateTo({
      url: '/pages/ification/ificationdetails/index'
    })
  }
  return (
    <View className='menu_bar'>
      {
        navList.map((item,index) => {
          return (
            <View className='menu_bar_item' key={index} onClick={() => {goToIfcationDetails(item,index)}}>
              <Image className='menu_bar_item_img' src={item.url} />
              <Text>{item.text}</Text>
            </View>
          )
        })
      }
      {/*{*/}
      {/*  <View className='show_more' onClick={() => {goIficatTion()}}>*/}
      {/*    <Text>查看更多</Text>*/}
      {/*  </View>*/}
      {/*}*/}
    </View>
  )
}
export default MenuBar
